<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ip_address', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('ip库');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->string('ip', 64)->comment('IP地址')->default('');
            $table->string('country_code', 16)->comment('国家代号')->default('');
            $table->string('country', 16)->comment('国家')->default('');
            $table->string('region', 16)->comment('区域')->default('');
            $table->string('province', 16)->comment('省份')->default('');
            $table->string('city', 16)->comment('市')->default('');
            $table->string('isp', 16)->comment('运营商')->default('');

            $table->index('create_time');
            $table->index('ip');
            $table->index('region');
            $table->index('province');
            $table->index('city');
            $table->index('isp');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('ip_address');
    }
};
